function [ ] = build(flag )
%BUILD builds the cpp files ( the 'all'  flag compiles all the files
%including those who are not part of maintieredmat).
    % compiling the files
    
    if nargin < 1 
        flag = 'not all';
    end
        
    if strcmpi(flag , 'all')
        disp('Building all!');
        mex ./tiered_labeling/cpp/tiered/maintiered.cpp;
        mex ./tiered_labeling/cpp/tiered/label.cpp;
        mex ./tiered_labeling/cpp/tiered/initializeWeight.cpp;
        mex ./tiered_labeling/cpp/tiered/loadModel.cpp;
    else
        disp('Building label and weight functions.');
        mex ./tiered_labeling/cpp/tiered/label.cpp;
        mex ./tiered_labeling/cpp/tiered/initializeWeight.cpp;
    end
    disp('Done compiling');
    
end